<?php
/**
 * Created by JetBrains PhpStorm.
 * User: luca
 * Date: 11/06/13
 * Time: 15:06
 * To change this template use File | Settings | File Templates.
 */




add_filter('module_field', 'adleex_module_render_field', 10, 2);
function adleex_module_render_field($field, $field_id) {
    global $post;

    if ($field_id=='parent') {

        $field['values'] = adleex_post_list(adleex_get_query('courses_all'), '0:none');
        echo $field['values'] ;
    }

    switch ($post->post_status) {
        case 'draft':
            break;
        case 'pending':
        case 'publish':
            if (in_array($field_id, array('module_parent', 'hour', 'startdate', 'enddate', 'dispensing',  'order', 'toenter', 'toview', 'toclose')))
 //               $field['readonly'] = true;
            break;
        case 'closed':
//            $field['readonly'] = true;
            break;
    }

    return $field;
}





add_filter('save_module', 'adleex_module_save',50,2);
function adleex_module_save($post_id, $post) {

    // devo aggiornare la tassonomia "placing"

}

